package com.itheima.enums;

import lombok.Getter;

import java.util.Objects;

/**
 * 非图纸审批
 */
@Getter
public enum NoDrawingsApproveEnum {
    //项目承接前用章
    INITIATOR("initiator", "发起人"),
    COMMERCIALTENDERCHECKER("commercialTenderChecker", "商务标书校核人"),
    TECHNICALTENDERREVIEWER("technicalTenderReviewer", "技术标书审核人"),
    DEPARTMENTHEAD("departmentHead", "部门负责人"),
    //用户组查询，见SealApplyGeneralUtil.findGroupUser， 运营管理部与项目类型挂钩，需转换，类型参考ProjectTypesEnum
    PROJECTOPERATIONMANAGEMENTDEPARTMENT("projectOperationManagementDepartment", "项目运营管理部", "", ""),
    //用户组查询，见SealApplyGeneralUtil.findGroupUser
    LAWWORKS("lawWorks", "法务", "G-YZSP-FW-01", "用章审批-法务"),
    //用户组查询，见SealApplyGeneralUtil.findGroupUser
    PROJECTGENERALCONTRACTING("projectGeneralContracting", "工程总承包", "G-YZSP-GCZCB-01", "用章审批-工程总承包"),
    //用户组查询，见SealApplyGeneralUtil.findGroupUser
    SEALCHAMBER("sealChamber", "盖章室", "G-YZSP-GZS-01", "用章审批-盖章室"),
    //用户组查询，见SealApplyGeneralUtil.findGroupUser
    SEALCHAMBERCOPY("sealChamber03", "盖章室03", "G-YZSP-GZS-03", "用章审批-盖章室03"),
    //项目用章申请
    VALIDATOR("validator", "审定人"),
    DESIGNHOST("designHost", "设计主持人"),
    PERSONINCHARGE("personInCharge", "专业负责人"),
    //项目运营管理部部门负责人 --- 部门code转换 见SealApplyGeneralUtil.findDeptLeaderByDeptNum
    PROJECTOPERATIONMANAGEMENTDEPARTMENTDEPARTMENTHEAD("projectOperationManagementDepartmentDepartmenthead", "项目运营管理部部门负责人", "30024013",""),
    //中国院项目运营管理部部门负责人
    PROJECTOPERATIONMANAGEMENTDEPARTMENTDEPARTMENTHEADBAK("projectOperationManagementDepartmentDepartmentheadBak", "项目运营管理部部门负责人", "30002173",""),
    //用户组查询，见SealApplyGeneralUtil.findGroupUser
    TECHNICALQUALITYDEPARTMENT("technicalQualityDepartment", "技术质量部", "G-YZSP-JSZLB-01", "用章审批-技术质量部"),
    //用户组查询，见SealApplyGeneralUtil.findGroupUser
    TECHNICALQUALITYDEPARTMENTCIRCULATE("technicalQualityDepartmentCirculate", "技术质量部-传阅", "G-YZSP-JSZLB-CY-01", "用章审批-技术质量部-传阅"),
    //技术质量部部门负责人 --- 部门code转换 见SealApplyGeneralUtil.findDeptLeaderByDeptNum
    TECHNICALQUALITYDEPARTMENTHEAD("technicalQualityDepartmentHead", "技术质量部部门负责人", "30024014", ""),
    //中国院技术质量部部门负责人
    TECHNICALQUALITYDEPARTMENTHEADBAK("technicalQualityDepartmentHeadBak", "技术质量部部门负责人", "30002036", ""),
    //用户组查询，见SealApplyGeneralUtil.findGroupUser
    PURCHASINGDEPARTMENT("purchasingDepartment", "采购部", "G-YZSP-CGB-01", "用章审批-采购部"),
    //采购部部门负责人 --- 部门code转换 见SealApplyGeneralU1·til.findDeptLeaderByDeptNum
    PURCHASINGDEPARTMENTHEAD("purchasingDepartmentHead", "采购部部门负责人", "30024007", ""),
    //中国院采购部部门负责人
    PURCHASINGDEPARTMENTHEADBAK("purchasingDepartmentHeadBak", "采购部部门负责人", "30002173", ""),
    //建筑工程设计文件（非图纸审批） 用户组查询，见SealApplyGeneralUtil.findGroupUser
    ENERGYSAVINGSEALAPPROVAL("energySavingSealapproval", "节能章审批", "G-YZSP-JNZ-01", "用章审批-节能章"),
    ENERGYSAVINGSEAL("energySavingSeal", "节能章人"),
    BUILDINGREGISTRAR("buildingRegistrar", "建筑注册章人","building",""),
    STRUCTUREREGISTRAR("structureRegistrar", "结构注册章人"),
    REGISTRAR("registrar", "注册章人"),
    HANDSIGNATURSEALE("handSignaturSeale", "手签章人"),
    MANAGINGDIRECTOR("managingDirector", "经营负责人"),
    PROJECTMANAGER("projectManager", "项目经理"),
    BUSINESSMANAGEMENTDEPARTMENT("businessManagementDepartment", "经营管理部"),
    APPROVALOFEPCBUSINESSDIVISION("approvalOfEPCBusinessDivision", "EPC事业部审批"),
    MAINDESIGNDEPARTMENTDEPARTMENTHEAD("mainDesignDepartmentDepartmenthead", "主设计部门部门负责人"),
    IMAGEFILEPERSONNEL("imageFilePersonnel", "图档人员", "30002249", ""),
    GENERALMANAGEROFFICE("generalManagerOffice", "总经理办公室"),
    TECHNICALQUALITYCENTEROFFFICE("technicalQualityCenterOffice", "技术质量中心办公室", "30002140",""),
    DESIGNQUALITYANDENGINEERINGSERVICESMANAGEMENTOFFICE("designQualityAndEngineeringServicesManagementOffice", "设计质量与工程服务管理办公室","30002213",""),


    //状态相关
    NONE("none","未提交"),
    AUDITING("auditing","审批中"),
    PASS("pass","审批通过"),
    REJECT("reject","被驳回"),
    WITHDRAW("withdraw","已撤回"),
    TERMINATION("termination","已终止") ,
    ADDSIGN("addSign","加签") ,
    //是否已经审批
    YES("yes","已经审批"),
    NO("no","没有审批"),
    //标准院
    COURTYARDTYPE("courtyardType","区分中国院还是标准院"),
    STANDARD("standard" ,"标准院","10035000",""),
    CHINA("china" ,"中国院","10015000",""),
    //流程的key
    SEALAPPLICATIONBEFOREUNDERTAKINGTHEPROJECT("sealApplicationBeforeUndertakingTheProject", "项目承接前用章申请"),
    PROJECTSEAL("projectSeal","项目用章申请表"),
    DESIGNDOCUMENT("designDocument","建筑工程设计文件（非图纸类）用章申请表"),
    //总监部 --- 角色 见SealApplyGeneralUtil.getRoleUser
    SENESCHAL("seneschal","总监部", "R-YZ-ZJB-1",""),
    //项目用印用途区分 Other technology
    TECHNOLOGYREGARDINGTHECHANGE("technologyRegardingTheChange","技术文件用印洽商变更类","100060101",""),
    TECHNOLOGYQUALITYACCEPTANCE("technologyQualityAcceptance","技术文件用印质量验收类","100060102",""),
    TECHNOLOGYCORRESPONDENCECLASS("technologyCorrespondenceClass","技术文件用印往来联系类","100060103",""),
    TECHNOLOGYAWARDAPPLICATIONCATEGORY("technologyAwardApplicationCategory","技术文件用印奖项申报类","100060104",""),
    TECHNOLOGYOTHERTECHNOLOGY("technologyOtherTechnology","技术文件用印其他技术文件","100060105",""),
    BUSINESSINVITATIONTOTENDERDOCUMENTSINQUIRYLETTER("businessInvitationToTenderDocumentsInquiryLetter","经营及日常文件用印邀标文件查询函","100060201",""),
    BUSINESSANDROUTINEDOCUMENTSSHALLBEPRINTEDONOTHERROUTINEBUSINESSDOCUMENTS("businessAndRoutineDocumentsShallBePrintedOnOtherRoutineBusinessDocuments","经营及日常文件用印其它经营日常文件","100060202",""),
    USESEALTYPE("useSealType","用印用途"),
    // 报错
    DEPARTMENTHEADNOTFOUND("departmentheadnotfound","部门负责人没找到"),
    PROJECTMANAGERNOTFOUND("projectmanagernotfound","项目经理无法找到"),
    //字段枚举
    USERID("userId","用户id"),
    FILESEALAPPLYID("file_seal_apply_id","业务表id"),
    APPROVESTATUS("approve_status","表单状态") ,
    USERNAME("userName","用户名"),
    APPROVEROLE("approver_role","角色"),
    APPROVERID("approver_id","审批人id"),
    INSTANCEID("instance_id","流程实例id");

    private String value;
    private String name;
    private String code;
    private String codeName;


    NoDrawingsApproveEnum(String value, String name) {
        this.value = value;
        this.name = name;
    }

    NoDrawingsApproveEnum(String value, String name, String code, String codeName) {
        this.value = value;
        this.name = name;
        this.code = code;
        this.codeName = codeName;
    }

    public static void main(String[] args) {
        NoDrawingsApproveEnum initiator = getValue("initiator");
        System.out.println(initiator.getValue());
    }


    /**
     * 通过value获取到name
     */
    public static NoDrawingsApproveEnum getValue(String role){
        NoDrawingsApproveEnum[] values = NoDrawingsApproveEnum.values();
        for(NoDrawingsApproveEnum value : values){
            if(value.getValue().equals(role)){
                return value;
            }
        }
        return null;
    }

    /**
     * 通过code返回value
     */
    public static NoDrawingsApproveEnum getValueByCode(String code){
        NoDrawingsApproveEnum[] values = NoDrawingsApproveEnum.values();
        for(NoDrawingsApproveEnum value : values){
            if(value.getCode()==null){
                continue;
            }
            if(value.getCode().equals(code)){
                return value;
            }
        }
        return null;
    }

    /**
     * 通过code返回value
     */
    public static String getName(String value){
        NoDrawingsApproveEnum[] values = NoDrawingsApproveEnum.values();
        for(NoDrawingsApproveEnum  valueArray : values){
            if(valueArray.getValue().equals(value)){
                return valueArray.getName();
            }
        }
        return null;
    }

}
